import { PdfLoader } from './pdfExportUtil'
export default {
  install(app) {
    /**
     * 生成pdf(A4多页pdf截断问题， 包括页眉、页脚 和 上下左右留空的护理)
     * @param param0
     * @returns
     */

    app.config.globalProperties.$exportPDF = async ({ id, filename }) => {
      const element = document.getElementById(id)
      const pdfLoader = new PdfLoader(element, {
        // outputType:'file',
        fileName: filename,
        // direction: "l",
        format: 'a4',
        isPageMessage: true
      })
      pdfLoader.getPdf().then((res) => {
        return new Promise((resolve, reject) => {
          resolve(res)
        })
      })
    }
  }
}
